﻿<UserControl x:Class="Dubs_Finder.View.SpecificDubViewUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:m="clr-namespace:Dubs_Finder.Model;assembly=Dubs_Finder.Model"
             mc:Ignorable="d">
    <UserControl.Resources>
        <ContextMenu x:Key="ListItemContextMenu">
            <MenuItem Header="Open file location" FontWeight="Bold" Click="menuItem_FileLocation_Click"/>
            <MenuItem Header="Set as primary file" Click="menuItem_SetPrimary_Click"/>
            <MenuItem Header="Delete only this" InputGestureText="Delete" Click="menuItem_DeleteFile_Click"/>
        </ContextMenu>
    </UserControl.Resources>
    <Grid>
        <ListView ItemsSource="{Binding SelectedDub}" SelectionMode="Single" MinWidth="50" MinHeight="50" x:Name="LVSelectedDub">
            <ListView.View>
                <GridView>
                    <GridViewColumn Width="auto" Header="File Name" x:Name="SDFileNameCol">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock TextTrimming="CharacterEllipsis" Text="{Binding FileName}"
                                           IsMouseDirectlyOverChanged="TextBlock_FileName_IsMouseDirectlyOverChanged">
                                    <TextBlock.ToolTip>
                                        <ToolTip Visibility="Collapsed">
                                            <TextBlock Text="{Binding FileName}"></TextBlock>
                                        </ToolTip>
                                    </TextBlock.ToolTip>
                                </TextBlock>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Width="auto" Header="Path" x:Name="SDFilePathCol">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock TextTrimming="CharacterEllipsis" Text="{Binding Path}"
                                           IsMouseDirectlyOverChanged="TextBlock_FilePath_IsMouseDirectlyOverChanged">
                                    <TextBlock.ToolTip>
                                        <ToolTip Visibility="Collapsed">
                                            <TextBlock Text="{Binding Path}"></TextBlock>
                                        </ToolTip>
                                    </TextBlock.ToolTip>
                                </TextBlock>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>

                </GridView>
            </ListView.View>
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="ContextMenu" Value="{StaticResource ListItemContextMenu}"/>
                </Style>
            </ListView.ItemContainerStyle>
        </ListView>
    </Grid>
</UserControl>
